package edu.sctu.zhengsenwen.month201506.day20150628;

import java.io.IOException;

/**
 * Created by user15 on 2015/6/28.
 */
public class Test {

    public static void main(String[] args) throws IOException, ClassNotFoundException {


        System.out.println("创文件夹Json，文本Json.txt和Appbean.txt");
        DirectoryAndTxt directoryAndTxt = new DirectoryAndTxt();
        directoryAndTxt.CreateDirectory();
        directoryAndTxt.CreateFile1();
        directoryAndTxt.CreateFile2();

        ThreadControl threadControl = new ThreadControl();
        System.out.println("5秒后获取数据");
        threadControl.run();


        System.out.println("将数据保存至D盘的Json文件夹下的Json.txt文本");
        directoryAndTxt.writeInJsontxt();

        HttpRequest httpRequest = new HttpRequest();
        String result = httpRequest.sendGet("http://api.ii.com.cn/goods/apprec","page=1&size=10");
        System.out.println("将数据转换为实体类");
        JsonUtil jsonUtil = new JsonUtil();
        jsonUtil.toPOJO(result);

        System.out.println("将数据保存至D盘的Json文件夹下的Appbean.txt文本里");
        directoryAndTxt.writeInAppbeantxt();

        System.out.println("判断商品价格，计算商品数量");
        Goods goods = new Goods();
        goods.goodsNumber();

    }
}
